package moltencore.game;

public abstract class AbstractPlayer {
	private final String name;
	private long clientId;
	private int positionIndex;

	protected AbstractPlayer(String name, long clientId) {
		this.name = name;
		this.clientId = clientId;
	}

	public long getClientId() {
		return clientId;
	}

	public String getName() {
		return name;
	}

	public void setPositionIndex(int positionIndex) {
		this.positionIndex = positionIndex;
	}

	public int getPositionIndex() {
		return positionIndex;
	}

	@Override
	public boolean equals(Object o) {
		if(this == o) return true;
		if(o == null || getClass() != o.getClass()) return false;

		AbstractPlayer that = (AbstractPlayer) o;

		if(clientId != that.clientId) return false;

		return true;
	}

	@Override
	public int hashCode() {
		return (int) (clientId ^ (clientId >>> 32));
	}
}
